<!--找回交易密码 -->
<div class="xf_zqzr_znx_window" id="xf_mem_aqwtsz_tc_dealPass">
	<div class="xf_wyjkwszl_4_windowInner xf_mem_aqwtsz_tc">
	<div class="xf_wyjkfb_4_windowClose" id="cancle"></div>
		<div class="xf_wyjkfb_4_windowColName">
			找回交易密码
		</div>
		<div class="xf_wyjkfb_aqwt_tclv">
		<div class="s_findby">
                                <span><input type="radio" name="find-style" id="find-style1" checked="checked" value="1" onclick="checkValue();"/><label for="find-style1">手机找回</label></span>
                                <span><input type="radio" name="find-style" id="find-style2" value="2" onclick="checkValue();"/><label for="find-style2">邮箱找回</label></span>
                            </div>
		</div>
		<!-- 安全问题设置 -->
		<div class="xf_mem_aqwtsz_qa">
			<ul id="findByMobile">
				<li>
					<div class="xf_mem_aqwtsz_qaname"><span class="xf_mem_aqwtsz_xx">*</span>用户名：${user?.name}</div>
				</li>
				<li>
					<div class="xf_mem_aqwtsz_qaname"><span class="xf_mem_aqwtsz_xx">*</span>绑定手机：${user?.mobile}</div>
				</li>
				<li>
					<div class="xf_mem_aqwtsz_qaname"><span class="xf_mem_aqwtsz_xx">*</span>输入校验码：
					    <input type="text" name="teleCode" id="teleCode" />
					    <input type="button" onClick="getCOde()" value="获取校验码" />
					</div>
				</li>
				<li>
					<div class="xf_mem_aqwtsz_qaname"><span class="xf_mem_aqwtsz_xx">*</span>输入新密码：
					    <input type="password" name="password" id="password" />
					</div>
				</li>
				<li>
					<div class="xf_mem_aqwtsz_qaname"><span class="xf_mem_aqwtsz_xx">*</span>再次输入新密码：
					     <input type="password" name="confirmPassword" id="confirmPassword" />
					</div>
				</li>
				<li class="xf_mem_aqwtsz_lalt2">
					<a class="xf_con_inputfbjk" id="resetdealPass">确定重置 </a>
				</li>
			</ul>
			#{form @resetPayPasswordByEmail(), id:'resetPayPasswordByEmail'}
			 <ul style="display:none;" id="findByEmail">
			<li>
					<div class="xf_mem_aqwtsz_qaname"><span class="xf_mem_aqwtsz_xx">*</span>绑定邮箱：${user?.email}</div>
					  <input type="hidden" value="${user?.email}" name="email"/>
				</li>
				
                     <li class="xf_mem_aqwtsz_lalt2">
					<a class="xf_con_inputfbjk" onclick="resetDelpwd();">确定修改 </a>
				</li>  
                         
               </ul>
            #{/form}                
		</div>
	</div>
</div>

<script type="text/javascript">
function resetDelpwd(){
	$("#resetPayPasswordByEmail").submit();
}
function checkValue(){
	var radioValue = $('input[name="find-style"]:checked').val();

	if(radioValue == 1){
		$("#findByMobile").attr("style", "display:block");
		$("#findByEmail").attr("style", "display:none");
	}else{
		$("#findByMobile").attr("style", "display:none");
		$("#findByEmail").attr("style", "display:block");
	}
}

$(function(){
	 $("#xf_mem_szansj_tc").hide();
 });
      
$("#resetdealPass").click(function(){
      var pass = $("#password").val().trim();
      var confirmPass = $("#confirmPassword").val().trim();

     if($("#teleCode").val() == ''){
         alert("校验码不能为空");
         return;
     }
     
     if(pass == ''){
         alert("新密码不能为空");
         return;
     }
     
     if(confirmPass == ''){
         alert("确认密码不能为空");
         return;
     }
     
     if(pass != confirmPass){
         alert("两次输入密码不一致");
         return;
     }

     var resetPayPassword = #{jsAction @resetPayPassword(':code', ':newPayPassword1', ':newPayPassword2', ':encryString')/}
	 $.post(resetPayPassword({code:$("#teleCode").val(), newPayPassword1:$("#password").val(),
	 newPayPassword2:$("#confirmPassword").val(), encryString:$("#encryString").val()}),function(data){
		 var arr = eval(data);
		 
		 if(arr.error.code < 0){
		     alert(arr.error.msg);
		     return;
		 }
		 
		 alert(arr.error.msg);
		 $("#xf_mem_aqwtsz_tc_dealPass").hide();
	});
 });
 
$("#findAnswer").click(function(){
    showDiv($("#xf_mem_aqwtsz_tc_dealPass"));
});

$("#cancle").click(function(){
     $("#xf_mem_aqwtsz_tc_dealPass").hide();
})

function getCOde(){
     var verifyMobile = #{jsAction @front.account.LoginAndRegisterAction.verifyMobile(':mobile')/}
	 $.post(verifyMobile({mobile:'${user?.mobile}'}),function(data){
	    var arr = eval(data);
	    
	    if(arr.error.code < 0){
	        alert(arr.error.msg);
	        return;
	    } 
	});
   }
</script>